package cn.net.yto.school.dao.entities;

import cn.net.yto.base.dao.entities.TAccount;
import lombok.Data;
import lombok.NoArgsConstructor;

import javax.persistence.*;
import java.io.Serializable;
import java.sql.Timestamp;

/**
 * tb_student 实体类
 * Created by gaojing
 * Wed Jul 18 20:11:47 CST 2018
 */
@Entity
@Table(name = "tb_student")
@Data
@NoArgsConstructor
public class TbStudent implements Serializable {
    private static final long serialVersionUID = -2663889035056226191L;
    /**
     * 学生id
     */
    @Id
    @GeneratedValue(strategy = GenerationType.IDENTITY)
    @Column(name = "stu_id", nullable = false, length = 11)
    private Integer id;

    /**
     * 班级id（学生归属）
     */
    @ManyToOne
    @JoinColumn(name = "cls_id", referencedColumnName = "cls_id")
    private TbClazz clazz;

    /**
     * 学生学号
     */
    @Column(name = "stu_code", nullable = false, length = 16)
    private String stuCode;

    /**
     * 学生生日
     */
    @Column(name = "stu_birth")
    private Timestamp stuBirth;

    /**
     * 学生姓名
     */
    @Column(name = "stu_name", nullable = false, length = 32)
    private String stuName;

    /**
     * 学生性别
     */
    @Column(name = "stu_gender", nullable = false, length = 16)
    private String stuGender;

    /**
     * 创建时间
     */
    @Column(name = "create_time")
    private Timestamp createTime;

    /**
     * 修改时间
     */
    @Column(name = "update_time")
    private Timestamp updateTime;

    /**
     * 操作员
     */
    @ManyToOne
    @JoinColumn(name = "actor", referencedColumnName = "ACCT_ID")
    private TAccount actor;


    public TbStudent(TbClazz clazz) {
        this.clazz = clazz;
    }
}

